package org.example.chatroom.demos.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.chatroom.demos.service.MessageSessionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RequestMapping("/session")
@Slf4j
@RestController
public class MessageSessionController {

   @Autowired
   private MessageSessionService messageSessionService ;

    @RequestMapping("/getSessionList")
    public Object getSessionList(HttpSession httpSession){
        return messageSessionService.getSessionList(httpSession) ;
    }

    @RequestMapping("/createSession")
    public Object createSession(Integer friendId , HttpSession httpSession){
         return messageSessionService.createSession(friendId , httpSession) ;
    }

    @RequestMapping("/getHistoryMessage")
    public Object getHistoryMessage(Integer sessionId){
        return messageSessionService.getHistoryMessage(sessionId) ;
    }


}
